package cl.sujey.school;

public class Course {

	private Evaluation[] evaluations;
	private int nEvaluations = 0;

	public Course() {
		this.evaluations = new Evaluation[3];
	}

	/**
	 * This constructor creates a course with a given number of evaluations.
	 * 
	 * @param numberOfEvaluations
	 *            The number of evaluations this course will have.
	 */
	public Course(int numberOfEvaluations) {
		this.evaluations = new Evaluation[numberOfEvaluations];
	}
	
	/**
	 * 
	 * @param student
	 * @return
	 */
	public double averageStudent(Student student) {
	
		/* Se recorren las evaluaciones hechas en este curso */
		double total = 0;
		for(Evaluation evaluation: this.evaluations){
			Mark mark = evaluation.getMark(student);
			double valor = mark . getValue();
			total += valor;
			
		}
		
		return total / nEvaluations;
	}
	
	public static void main(String[] args) {
		
		for(String argument: args){
			System.out.println("Argumento: " + argument);
		}
		
		/*
		Student sujy = new Student("Sujy");
		Student andy = new Student("Andy");
		Course math = new Course(2);
		
		Evaluation p1 = new Evaluation();
		math.addEvaluation(p1);
		p1.addMark(new Mark(sujy, 5));
		p1.addMark(new Mark(andy, 4));
		
		
		Evaluation p2 = new Evaluation();
		math.addEvaluation(p2);
		p2.addMark(new Mark(sujy, 6));
		p2.addMark(new Mark(andy, 5));
		
		double finalMark = math.averageStudent(sujy);
		System.out.println("Sujy saco un: " + finalMark);
		*/
	}

	private void addEvaluation(Evaluation evaluation) {
		this.evaluations[nEvaluations++] = evaluation;
	}
	
}

